# coding:utf8


'''
Created on 2016年1月22日

@author: Administrator
'''


class HtmlOutputer(object):
    
    def __init__(self):
        self.datas = []
    
    def collect_data(self, data):
        if data is None:
            return None
        self.datas.append(data)

    
    def html_output(self):
        fout = open('output.html', 'w', encoding = 'utf-8')
        
        fout.write("<html><meta charset=\"utf-8\" />")
        fout.write("<body>")
        fout.write("<table>")
        
        for data in self.datas:
            fout.write("<tr>")
            fout.write("<td>%s</td>" % data['url'])
            fout.write("<td>%s</td>" % data['title'])
            fout.write("<td>%s</td>" % data['summary'])
            fout.write("</tr>")
        
        fout.write("</table>")
        fout.write("</body>")
        fout.write("</html>")
        
        fout.close()
    
    
    
    



